package com.sharemarking.wa.platform.controller;

import cn.jiguang.common.ClientConfig;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.Notification;
import com.sharemarking.wa.common.ResponseParams;
import com.sharemarking.wa.platform.config.JGPushConfig;
import com.sharemarking.wa.platform.service.JGPushService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author dxy
 */
@RestController
@RequestMapping(value = "JGPush")
public class JGPushController {
    @Autowired
    private HttpServletRequest request;
    @Autowired
    private JGPushService jgPushService;


    /**
     *推送全部
     * @return
     * @throws Exception
     */
    @RequestMapping("pushAll")
    public ResponseParams<?> pushAll() throws Exception {
        return jgPushService.pushAll();
    }

    /**
     *推送（协议通过）
     * @return
     * @throws Exception
     */
    @RequestMapping("pushByAgreementPassed")
    public ResponseParams<?> pushByAgreementPassed() throws Exception {
        return jgPushService.pushByAgreementPassed();
    }
//    /**
//     *根据tag推送
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping("pushTag")
//    public ResponseParams<?> pushTag() throws Exception {
//        return jgPushService.pushTag();
//    }


}
